<template>
  <van-tabbar v-model="selectedTab" fixed  route>
    <!-- <van-tabbar-item icon="home-o" :to="{name:'home'}">首页</van-tabbar-item>
	<van-tabbar-item icon="gift-o" :to="{name:'product'}">商品</van-tabbar-item>
	<van-tabbar-item icon="shopping-cart-o" :to="{name:'shopcart'}" :badge="shopcartCount">购物车</van-tabbar-item>
	<van-tabbar-item icon="user-o" :to="{name:'user'}">我的</van-tabbar-item> -->
    <van-tabbar-item v-for="(item,i) in tabbarItems" :key="i"
	:icon="item.icon"
	:to="{name:item.routeName}">
	{{item.title}}
	</van-tabbar-item>
  </van-tabbar>
</template>

<script>
  export default { 
	name:"footerNav",
    data() {
      return {
		// shopcartCount:15,
        selectedTab: 0, //选中的TabBar
        tabbarItems: [{
            title: "首页",
            routeName: "home",
            icon:"home-o",
          },
          {
            title: "商品",
            routeName: "product",
            icon:"gift-o",
          },
          {
            title: "购物车",
            routeName: "shopcart",
            icon:"shopping-cart-o",
          },
          {
            title: "我的",
            routeName: "user",
            icon:"user-o",
          },
        ],
      };
    },
    methods: {
      // onChange(index) {
      //   this.$router.push({
      //     name: this.tabbarItems[index].routeName
      //   });
      // },
    },
  };

</script>
